Open
Conversation
Generate changelog in
|
| .collect(Collectors.joining(System.lineSeparator())); | ||
|
|
||
| return String.format( | ||
| "STDERR: %s\n\n------\n\nSTDOUT: %s\n", |
Contributor
There was a problem hiding this comment.
can we just use multi line strings here?
| String commandOutput = dockerComposeCommand.execute(errorHandler, "rm", "-f"); | ||
|
|
||
| assertThat(commandOutput).isEqualTo(expectedOutput); | ||
| assertThat(commandOutput).isEqualTo("STDERR: <empty>\n\n------\n\nSTDOUT: " + expectedOutput + "\n"); |
Contributor
There was a problem hiding this comment.
with multi line strings you should be able to do something like:
assertThat(commandOutput).isEqualTo(
"""
STDERR: <empty>
------
STDOUT: %s
""", expectedOutput);assertj has some nice utility methods to do string formatting inside
Contributor
There was a problem hiding this comment.
It also gives me a way to see what the actual error message would look like.
So much so, I would actually just put the content for each stream on a new line
e.g.
STDERR:
<empty>
------
STDOUT:
%s
Contributor
|
approach seems fine, you may end up breaking people if they expect only stdout, so maybe add an option to say "merge output streams" or something |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this PR
We don't have access to the stderr. When the process failed internally, the stdout made it seem like the error was related to something else (stdout!), which was misleading.
After this PR
Output returns stderr
==COMMIT_MSG==
==COMMIT_MSG==
Possible downsides?
It's a draft to discuss the format of the output:
I'll update the remainder of the tests once agreed on the format!